package router

import (
	"a-admin/web/controller"

	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/websocket/v2"
)

func InitWebsoketRoutes(r fiber.Router) {
	sseCtrl := controller.NewRtcSseController()
	wsCtrl := controller.NewRtcWsController()

	rg := r.Group("/rtc")
	{
		// 不能使用路径传参，fiber有bug！！！
		rg.Get("/sse", sseCtrl.SseHandler)
		rg.Get("/sse/send/:userid/:msg", sseCtrl.SendTestMsg)
		rg.Get("/sse/ssetest", sseCtrl.Ssetest)

		rg.Get("/ws", websocket.New(wsCtrl.WsHandler))
		rg.Get("/ws/send/:userid/:msg", wsCtrl.SendTestMsg)
	}
}
